package com.rzj.sys_lab_assistant.service.impl;

import com.rzj.sys_lab_assistant.dao.RecruitmentPostMapper;
import com.rzj.sys_lab_assistant.entity.RecruitmentPost;
import com.rzj.sys_lab_assistant.entity.bo.RecruitmentPostBO;
import com.rzj.sys_lab_assistant.service.IRecruitmentPostService;
import com.rzj.sys_lab_assistant.utils.TimeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: sys_lab_assistant
 * @description:
 * @author: 作者
 * @create: 2021-07-01 15:23
 */
@Service
public class RecruitmentPostServiceImpl implements IRecruitmentPostService {

    @Autowired
    RecruitmentPostMapper recruitmentPostMapper;

    TimeUtils timeUtils;

    @Override
    public List<RecruitmentPostBO> recruitmentPostsListByAccount(String account) {
        return recruitmentPostMapper.listRecruitmentPostsByAccount(account);
    }

    @Override
    public List<RecruitmentPostBO> recruitmentPostsList() {
        return recruitmentPostMapper.listRecruitmentPosts();
    }

    @Override
    public RecruitmentPostBO getRecruitmentPostById(int postId) {
        return recruitmentPostMapper.getRecruitmentPostById(postId);
    }

    @Override
    public int countRecruitmentPosts(int postId) {
        return recruitmentPostMapper.countRecruitmentPosts(postId);
    }

    @Override
    public int addRecruitmentPost(RecruitmentPost recruitmentPost) {
        recruitmentPost.setCreateTime(timeUtils.getTime());
        recruitmentPost.setModifyTime(timeUtils.getTime());
        return recruitmentPostMapper.saveRecruitmentPost(recruitmentPost);
    }

    @Override
    public int updateRecruitmentPost(RecruitmentPost recruitmentPost) {
        recruitmentPost.setModifyTime(timeUtils.getTime());
        return recruitmentPostMapper.updateRecruitmentPost(recruitmentPost);
    }

    @Override
    public int delRecruitmentPost(int postId) {
        return recruitmentPostMapper.deleteRecruitmentPost(postId);
    }
}
